﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CloudJump : MonoBehaviour {

    private void OnTriggerEnter(Collider other)
    {
        //脚下的Trigger.
        Debug.Log(other.tag + "进入了");
        //先这样吧
        if (other.tag == "Player")
        {
            var rg = other.GetComponent<Rigidbody>();
            rg.velocity = new Vector3(rg.velocity.x, 5.0f, rg.velocity.z);
        }
        if (other.transform.parent != null)
        {
            if (other.transform.parent.tag == "Player")
            {
                var rg = other.transform.parent.GetComponent<Rigidbody>();
                rg.velocity = new Vector3(rg.velocity.x, 8.0f, rg.velocity.z);
            }
        }
        
    }
}
